package com.jiji.miaosha.util;

import com.jiji.miaosha.vo.ResultVO;

public class ResultVOUtil {

    /**
     * @param object
     * @return
     * @decribe: 封装成功返回数据
     */
    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setData(object);
        resultVO.setMsg("success");
        resultVO.setCode(0);
        return resultVO;
    }

    public static ResultVO success() {
        return success(null);
    }

    /**
     * @param code
     * @param msg
     * @return
     * @decribe: 封装失败返回数据
     */
    public static ResultVO error(Integer code, String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setMsg(msg);
        resultVO.setCode(code);
        return resultVO;
    }
}
